﻿using System;
using System.Collections.Generic;
using System.Data;

namespace Smarly.Bussines.Model.Payment.YandexMoney
{
	public class OperationDetails
	{
// ReSharper disable InconsistentNaming
		public string error { get; set; }

		public string operation_id { get; set; }
		public string status { get; set; }
		public string pattern_id { get; set; }
		public string direction { get; set; }
		public decimal amount { get; set; }
		public DateTime datetime { get; set; }
		public string title { get; set; }
		public string sender { get; set; }
		public string recipient { get; set; }
		public string recipient_type { get; set; }
		public string message { get; set; }
		public string comment { get; set; }
		public bool codepro { get; set; }
		public string label { get; set; }
		public string details { get; set; }
// ReSharper restore InconsistentNaming


		public string ErrorDescription
		{
			get
			{
				string errorMessage;
				switch (error)
				{
					case "illegal_param_operation_id":
						errorMessage = "Неверное значение параметра operation_id.";
						break;
					default:
						errorMessage = "Error: " + error;
						break;
				}

				return errorMessage;
			}
		}


/*		public void Put(long purchaseId)
		{
			SqlRepository.ExecuteProcedureReader("Purchase_OperationDetails_Put",
																					 new List<SpParam>
			                                     	{
			                                     		new SpParam {Name = "@purchaseId", Value = purchaseId, Type = DbType.Int64},

			                                     		new SpParam {Name = "@operationDetailsError", Value = error, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsErrorInfo", Value = string.IsNullOrWhiteSpace(error) ? null : ErrorDescription, Type = DbType.String},

			                                     		new SpParam {Name = "@operationDetailsOperationId", Value = operation_id, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsStatus", Value = status, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsPatternId", Value = pattern_id, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsDirection", Value = direction, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsAmount", Value = amount, Type = DbType.Decimal},
			                                     		new SpParam {Name = "@operationDetailsDatetime", Value = datetime, Type = DbType.DateTime},
			                                     		new SpParam {Name = "@operationDetailsTitle", Value = title, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsSender", Value = sender, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsRecipient", Value = recipient, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsRecipientType", Value = recipient_type, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsMessage", Value = message, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsComment", Value = comment, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsCodepro", Value = codepro, Type = DbType.Boolean},
			                                     		new SpParam {Name = "@operationDetailsLabel", Value = label, Type = DbType.String},
			                                     		new SpParam {Name = "@operationDetailsDetails", Value = details, Type = DbType.String},
			                                     	}, null,
																					 reader => this);
		}*/
	}
}